using System;
using System.Collections.Generic;
using System.Text;
using SlimDX;
using SlimDX.Direct3D9;
using Barrage.Meshes;
using Barrage.Shaders;

namespace Barrage.Items
{
    /// <summary>
    /// A PostProcess item is simply an Item with a PostProcessMesh
    /// </summary>
    public class Postprocess:Item
    {
        /// <summary>
        /// Constructor. Inits a PostprocessMesh with the specified texture
        /// </summary>
        /// <param name="source">Texture used in the mesh</param>
        public Postprocess(Texture source)
        {
            meshes.Add(new PostprocessMesh(source));
        }
        /// <summary>
        /// Constructor. Inits a PostprocessMesh with the specified texture and shader
        /// </summary>
        /// <param name="source">Texture used in the mesh</param>
        /// <param name="shader">Shader used in the mesh</param>
        public Postprocess(Texture source, Shader shader)
        {
            Mesh m = new PostprocessMesh(source);
            m.Shader = shader;
            meshes.Add(m);
        }

        /// <summary>
        /// Constructor. Inits a PostprocessMesh with the specified texture and shader
        /// </summary>
        /// <param name="source">Texture used in the mesh</param>
        /// <param name="shaderFile">Shader file path</param>
        public Postprocess(Texture source, string shaderFile)
        {
            Mesh m = new PostprocessMesh(source);
            m.Shader = new D3DShader(shaderFile);
            meshes.Add(m);
        }

        /// <summary>
        /// Returns the material of the postprocess mesh
        /// </summary>
        public Material Material { get { return meshes[0].Materials[0]; } }
    }
}
